'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller,jwt } = app;
  router.get('/', controller.views.index);
  router.get('/case', controller.views.case);
  router.get('/news', controller.views.news);
  router.get('/team', controller.views.team);
  router.get('/doc', controller.views.doc);
  router.get('/contact', controller.views.contact);
  router.get('/about', controller.views.about);
  router.get('/services', controller.views.services);
  router.get('/news/detail/:id', controller.views.newsDetail);
  //用户相关接口
  router.post('/user/login',controller.user.login); //登录
  router.post('/user/reg',controller.user.reg);//注册

  //文件接口
  router.post('/upload',jwt,controller.upload.upload);//文件上传
  router.post('/uploadStream',jwt,controller.upload.uploadStream);//文件流上传
  router.post('/getUrlByIds',jwt,controller.upload.getUrlByIds);//文件url获取
  

  //home相关
  router.get('/home/getInfo',jwt,controller.home.getInfo);
  router.post('/home/update',jwt,controller.home.update);//信息更新
  router.get('/getBanner',jwt,controller.home.getBanner);
  router.post('/addBanner',jwt,controller.home.addBanner)
  router.post('/updateBanner',jwt,controller.home.updateBanner)
  router.post('/removeBanner',jwt,controller.home.removeBanner)

  //case相关
  
  router.post('/getCase',jwt,controller.case.getCase);
  router.post('/addCase',jwt,controller.case.addCase)
  router.post('/updateCase',jwt,controller.case.updateCase)
  router.post('/removeCase',jwt,controller.case.removeCase)
  router.post('/getCaseByType',controller.case.getCaseByType)
  //


  //news相关
  
  router.post('/getNews',jwt,controller.news.getNews);
  router.post('/addNews',jwt,controller.news.addNews)
  router.post('/updateNews',jwt,controller.news.updateNews)
  router.post('/removeNews',jwt,controller.news.removeNews)
  router.get('/news/getDetail',jwt,controller.news.getNewsById)


  //team相关
  router.post('/getTeam',jwt,controller.team.getTeam);
  router.post('/addTeam',jwt,controller.team.addTeam)
  router.post('/updateTeam',jwt,controller.team.updateTeam)
  router.post('/removeTeam',jwt,controller.team.removeTeam)

  //doc相关
  //case相关
  
  router.post('/getDoc',jwt,controller.file.getDoc);
  router.post('/addDoc',jwt,controller.file.addDoc)
  router.post('/updateDoc',jwt,controller.file.updateDoc)
  router.post('/removeDoc',jwt,controller.file.removeDoc)

  //字典相关
  router.post("/addDict",jwt,controller.dict.addDict) 
  router.post("/updateDict",jwt,controller.dict.updateDict)
  router.post("/getDict",jwt,controller.dict.getDict)
  router.post("/removeDict",jwt,controller.dict.removeDict)
  router.post("/getDictByCode",jwt,controller.dict.getDictByCode)
};
